class FavoriteController < ApplicationController

  def index
    @favorites = Favorite.search(" user_id = " + current_user.id.to_s, params[:page], "created_at desc")
  end

  def create
    favorite = Favorite.new
    favorite.user_id = current_user.id
    favorite.weibo_id = params[:weibo]
    favorite.save
    redirect_to :action => :index
  end

  def destroy
    @favorites = Favorite.find(params[:id])
    @favorites.destroy
    redirect_to :action => :index
  end

end
